const path = require("path");

function resolve(dir) {
  return path.join(__dirname, dir);
}
const name = "litemall"; // page title

module.exports = {
  publicPath: "./",
  outputDir: "dist",
  assetsDir: "static",
  lintOnSave: process.env.NODE_ENV === "development",
  productionSourceMap: false,
  devServer: {
    proxy: {
      "/api": {
        // 匹配所有以 '/api1'开头的请求路径
        target: "http://localhost:3001", // 代理目标的基础路径
        changeOrigin: true,
        pathRewrite: { "^/api": "" },
        
      },
    },
    // open: true, // 启动项目自动打开浏览器
    overlay: {
      warnings: false,
      errors: true,
    },
  },
  configureWebpack: {
    name: name,
    resolve: {
      alias: {
        "@": resolve("src"),
      },
    },
  },
};
